package net.sf.brutil.v0.server;

import net.sf.brutil.v0.light.ErrorUtil;


public class MiscServerUtil {

	public static Class<?> isClassAssignableToOneOf(Object t,Class<?> ...dontPropagates) {
		
		if (t==null) return null;
		for(Class<?> dontPropagate:dontPropagates)
			if (dontPropagate.isAssignableFrom(t.getClass())){
				return dontPropagate;
			}
	   
	    
	   return null; 
		
	}


	/**
	 * without the named exception... aaarrrg
	 * 
	 */
	public static void sleep(int millis) {
		try {
			Thread.sleep(millis);
		} catch (InterruptedException e) {
			throw ErrorUtil.propagateError(e);
		}
		
	}


    public static void  byteArrayCopy(byte[] dest,byte[]src,int idxStartDest,int idxStartSrc,int bytes){
        for(int idx=0;idx<bytes;idx++){
            dest[idxStartDest+idx]=src[idxStartSrc+idx];
        }
    }

}
